<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>正中信息-信息技术咨询和管理科技服务云平台</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css" media="all"/>
    <!--公用样式-->
    <link rel="stylesheet" href="${re.contextPath}/plugin/common/css/comment.css">
    <!--页面样式-->
    <link rel="stylesheet" href="${re.contextPath}/plugin/common/css/style.css">
    <link rel="stylesheet" href="${re.contextPath}/plugin/common/css/extended.css">
    <script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.js"></script>
    <script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
    <script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js"></script>
    <style>
        #sysss_ul span{
            display: block;
            max-width: 144px;
            overflow: hidden;
            text-overflow:ellipsis;
            white-space: nowrap;
        }
    </style>
</head>
<body style="overflow-y: hidden;">
<!--头部-->
<header class="whitebg">
    <div class="clearfix">
        <a href="/index"><img src="${re.contextPath}/plugin/common/images/2@2xnewlogo.png"  style="width: 308px" class="logo" alt=""/></a>
        <div class="mineData fr clearfix mt10">
            <#if "${file}" !="${null}" && (file.xgtx) != "${null}">
                <img class="ml10" src="${file.xgtx}" alt="" id="mainimg7">
            <#else>
                <#if "${user}" !="${null}" && (user.personType) == "002">
                    <img class="layui-upload-img ml10" id="mainimg7" src="/plugin/common/images/zzlogo.jpg">
                <#else>
                    <img class="layui-upload-img ml10" id="mainimg7" src="${re.contextPath}/plugin/common/images/29@2x.png">
                </#if>
            </#if>
            <nav class="fl ml10">
                <p class="fr18">
                    ${username}
                </p>
                <p class="gary">
                    <a href="/logout"><i class="fa fa-sign-out" aria-hidden="true"></i> 退出</a>
                </p>
            </nav>
        </div>
    </div>
</header>
<!--容器-->
<div class="container index clearfix">
    <!--占位-->
    <div class="headerHight"></div>
    <!--左侧菜单栏-->
    <div id="main_left" class="Left gary whitebg fl">
        <ul class="mt20" id="project">
            <a href="/main">
                <li class="clearfix focus">
                    <img src="${re.contextPath}/plugin/common/images/37@2x.png" alt="" class="fl icon hide" />
                    <img src="${re.contextPath}/plugin/common/images/33@2x.png" alt="" class="fl icon " />
                    <span class="fl">首页</span>
                    <img src="${re.contextPath}/plugin/common/images/41@2x.png" alt="" class="fr next"/>
                </li>
            </a>
            <a href="javascript:void(0);" lay-ay="/sys/personCenter/index">
                <li class="clearfix">
                    <img src="${re.contextPath}/plugin/common/images/34@2x.png" ficon="38@2x" alt="" class="fl icon"/>
                    <img src="${re.contextPath}/plugin/common/images/38@2x.png" alt="" class="fl icon  hide" />
                    <span class="fl">个人中心</span>
                    <img src="${re.contextPath}/plugin/common/images/42@2x.png" alt="" class="fr next"/>
                </li>
            </a>
            <a href="javascript:void(1);" lay-ay="/sys/statistics/mydata">
                <li class="clearfix">
                    <img src="${re.contextPath}/plugin/common/images/35@2x.png" ficon="39@2x" alt="" class="fl icon"/>
                    <img src="${re.contextPath}/plugin/common/images/39@2x.png" alt="" class="fl icon  hide" />
                    <span class="fl">数据统计</span>
                    <img src="${re.contextPath}/plugin/common/images/42@2x.png" alt="" class="fr next"/>
                </li>
            </a>
            <a href="javascript:void(0);" lay-ay="/sys/statistics/mydata2">
                <li class="clearfix">
                    <img src="${re.contextPath}/plugin/common/images/36@2x.png" ficon="40@2x" alt="" class="fl icon"/>
                    <img src="${re.contextPath}/plugin/common/images/40@2x.png" alt="" class="fl icon  hide" />
                    <span class="fl">我的工作</span>
                    <img src="${re.contextPath}/plugin/common/images/42@2x.png" alt="" class="fr next"/>
                </li>
            </a>
            <@shiro.hasRole name="admin">
                <a href="${re.contextPath}/toAdmin" target="_blank">
                    <li class="clearfix">
                        <img src="${re.contextPath}/plugin/common/images/manage1.png" ficon="39@2x" alt="" class="fl icon"/>
                        <img src="${re.contextPath}/plugin/common/images/manage2.png" alt="" class="fl icon hide" />
                        <span class="fl">系统管理</span>
                        <img src="${re.contextPath}/plugin/common/images/42@2x.png" alt="" class="fr next"/>
                    </li>
                </a>
            </@shiro.hasRole>
        </ul>

<#--        <ul class="mt20">-->
<#--            <li class="clearfix"  style="padding: 3%;margin-left: 5px">-->
<#--                <div class="fl"  style="width: 100%;color: blue">-->
<#--                    <h5>云平台APP(安卓版)</h5>-->
<#--                    <img src="${re.contextPath}/plugin/common/images/appdown.png" height="100px" width="100px"  style="margin-left: 10px" />-->
<#--                </div>-->
<#--            </li>-->
<#--            </a>-->
<#--        </ul>-->
    </div>
<#--<div class="placeholder" style=""></div>-->
    <!--右侧内容-->
    <div id="main_right" class="Right fl" style="margin-left: 14vw;">
        <!--容器-->
        <div class="container index clearfix" id="main_index" style="overflow-y: auto;height: calc(100vh - 86px);">
            <!--右侧内容-->
            <div class="Right fr" id="center" style="width: 100%;overflow-y: auto;">
                <!--模块-->
                <div class="module whitebg" id="center-1">
                    <div class="bold ft26">欢迎使用信息技术咨询和管理科技服务云平台!</div>
                    <ul id="sysss_ul" class="clearfix">
                        <li>
                            <#--<a target="_self" href="" class="white" permission="gx:index">-->
                            <a target="_self" href="/project/projectManager/index" class="white" permission="project:index">
                                <img src="${re.contextPath}/plugin/common/images/43@2x.png" alt=""
                                     class="fl moduleIcon mt47">
                                <span class="fl bold ft20 mt43">监理模版规范</span>
                                <img src="${re.contextPath}/plugin/common/images/50@2x.png" alt="" class="fr moduleBg">
                                <@shiro.hasPermission name="project:index">
                                    <allow></allow>
                                </@shiro.hasPermission>
                            </a>
                        </li>
<#--                        <li>-->
<#--                            &lt;#&ndash;<a target="_self" href="" class="white" permission="gx:index">&ndash;&gt;-->
<#--                            <a target="_self" href="/supplier/index" class="white" permission="gx:index">-->
<#--                                <img src="${re.contextPath}/plugin/common/images/43@2x.png" alt=""-->
<#--                                     class="fl moduleIcon mt47">-->
<#--                                <span class="fl bold ft20 mt43">供需对接服务系统</span>-->
<#--                                <img src="${re.contextPath}/plugin/common/images/50@2x.png" alt="" class="fr moduleBg">-->
<#--                                <@shiro.hasPermission name="gx:index">-->
<#--                                    <allow></allow>-->
<#--                                </@shiro.hasPermission>-->
<#--                            </a>-->
<#--                        </li>-->
<#--                        <li>-->
<#--                            <a target="_self" href="/project/projectManager/index" class="white" permission="zx:index">-->
<#--                                <img src="${re.contextPath}/plugin/common/images/44@2x.png" alt=""-->
<#--                                     class="fl moduleIcon mt47">-->
<#--                                <span class="fl bold ft20 mt43">项目文件集</span>-->
<#--                                <img src="${re.contextPath}/plugin/common/images/51@2x.png" alt="" class="fr moduleBg">-->
<#--                                <@shiro.hasPermission name="zx:index">-->
<#--                                    <allow></allow>-->
<#--                                </@shiro.hasPermission>-->
<#--                            </a>-->
<#--                        </li>-->
                        <li>
                            <a target="_self" href="/supervisor/projectManager/index" class="white" permission="jx:index">
                                <img src="${re.contextPath}/plugin/common/images/45@2x.png" alt=""
                                     class="fl moduleIcon mt47">
                                <span class="fl bold ft20 mt43">监理服务系统</span>
                                <img src="${re.contextPath}/plugin/common/images/52@2x.png" alt="" class="fr moduleBg">
                                <@shiro.hasPermission name="jx:index">
                                    <allow></allow>
                                </@shiro.hasPermission>
                            </a>
                        </li>
                        <li>
                              <a target="_self" href="/project/projectManager/index?type=wjj" class="white" permission="projectfile:index">
                                <img src="${re.contextPath}/plugin/common/images/48@2x.png" alt=""
                                     class="fl moduleIcon mt47">
                                <span class="fl bold ft20 mt43">项目文件集</span>
                                <img src="${re.contextPath}/plugin/common/images/55@2x.png" alt="" class="fr moduleBg">
                                <@shiro.hasPermission name="projectfile:index">
                                    <allow></allow>
                                </@shiro.hasPermission>
                            </a>
                        </li>

                        <li>
                            <a target="_self" href="/project/projectManager/index?type=jd" class="white" permission="projectJd:index">
                                <img src="${re.contextPath}/plugin/common/images/46@2x.png" alt=""
                                     class="fl moduleIcon mt47">
                                <span class="fl bold ft20 mt43">项目进度管理</span>
                                <img src="${re.contextPath}/plugin/common/images/55@2x.png" alt="" class="fr moduleBg">
                                <@shiro.hasPermission name="projectJd:index">
                                    <allow></allow>
                                </@shiro.hasPermission>
                            </a>
                        </li>
                    </ul>
                </div>
                <!--项目进度-->

                <@shiro.hasPermission name ="view:process">
                    <div class="process whitebg">

                        <table id="stageList" class="layui-hide" lay-filter="stage"></table>

                    </div>
                </@shiro.hasPermission>

                <!--流程中心-->
                <div class="process whitebg">
                    <div>
                        <span class="bold ft26">流程中心</span>
                        <div class="fr" style="margin-bottom: 20px;">
                            <button type="button" id="moreCz" class="layui-btn layui-btn-normal"
                                    style="background-color: #5775EF;width: 80px;">更多>
                            </button>
                        </div>
                    </div>
                    <iframe id="lcframe" frameborder="0" name="lcframe" style="width:100%;height:800px;"
                            border="0"></iframe>
                    <h4  style="text-align: center;vertical-align: center;color:#AAAAAA">系统版本:V1.5.8</h4>
                </div>
            </div>
        </div>
        <iframe id="mainframe" frameborder="0" name="main" style="width:100%;height:800px;" border="0"></iframe>
    </div>
</div>
<!--公用样式JS-->
<script type="text/javascript" charset="utf-8" src="${re.contextPath}/plugin/common/js/comment.js"></script>
<script>
    var layer,table;
    //只需要找到你点击的是哪个ul里面的就行
    $("#project a").click(function () {
        if(this.text.trim() == '系统管理'){
            return ;
        }
        $("#main_index").remove();
        $(this).parent().find('li').removeClass('focus');
        $(this).parent().find('li').each(function (i,v){
            $(v).find('img:eq(0)').removeClass("hide");
            $(v).find('img:eq(1)').addClass("hide");
            $(v).find('img:eq(2)').attr("src","${re.contextPath}/plugin/common/images/42@2x.png");
        })
        $(this).find('li').addClass('focus');
        $(this).find('li').find('img:eq(0)').addClass("hide");
        $(this).find('li').find('img:eq(1)').removeClass("hide");
        $(this).find('li').find('img:eq(2)').attr("src","${re.contextPath}/plugin/common/images/41@2x.png");
        $("#mainframe").attr("src", $(this).attr("lay-ay")).css({height: (_gwinhght - $(".headerHight").height()) + 'px'});
    });
    // 更多操作
    $("#moreCz").click(function () {
        $("#project a:eq(3)").click();
    });
    var _gwinhght = $(window).height();
    var _gwinwdth = $(document).width();
    var _gmaxhght = _gwinhght - $(".headerHight").height();
    // $("#main_index").height(_gmaxhght);
    // $("#main_right").css({
    //
    // });
    $("#lcframe").attr("src", "/sys/statistics/mydata2?jztype=002");
    $(function () {
        layui.use(['layer','table'], function () {
            layer = layui.layer;
            table = layui.table;
            setTimeout(function(){
                var noticeMsg = '${noticeMessage}';
                console.log("noticeMsg");
                console.log(noticeMsg);
                if(noticeMsg){
                    //用户首次登录，并且用户没有维护邮箱的情况，弹窗提示：
                    layer.open({
                        type: 1,
                        offset: "auto",
                        area: ['600px', '300px'],
                        id: 'layerDemo１',
                        content: '<div style="align-content: center;"><div style="margin-top: 10px;margin-left: 30px;margin-right: 30px;" class="b">'+noticeMsg+'</div></div>',
                        btn: '关闭全部',
                        btnAlign: 'c',
                        shade: 0,
                        btn: ['去完善', '关闭'],
                        yes: function () {
                            $("#project a:eq(1)").click();
                            layer.closeAll();
                        },
                        btn2: function () {
                            layer.closeAll();
                        }
                    });
                }
            },500);
            // 初始化 项目进度表格
            innitProjectProcessTable();
        });
        $("#sysss_ul a").click(function(){
            var allow = $(this).find('allow');
            var permission = $(this).attr('permission');
            if(allow.length <= 0){
                $.ajax({
                    url: '/sys/dict/getDictByBadtCode',
                    data: {badtCode: permission,badtTypecode:'QSQXTS001'},
                    type: 'get',
                    cache: false,
                    dataType: 'json',
                    success: function(res){
                        var message = '没有权限';
                        if(res.flag){
                            message = res.data.badtName;
                        }
                        layer.alert(message, {
                            title: '提示',
                            icon: 5,
                            closeBtn :0,
                        })
                    }
                })
                return false;
            }else{
                var span=$(this).find('span').text();
                if(span=='供需对接服务系统'){
                    $.ajax({
                        url:'/user/selectGxtype',
                        type:'post',
                        data:'',
                        success:function(d){
                            if(!d.flag){
                                layer.confirm('请先完善供需类型', {
                                    btn: ['确定','关闭'] //按钮
                                }, function(){
                                    var type = "auto";
                                    layer.open({
                                        type: 1
                                        ,
                                        offset: type, //
                                        area: ['400px', '180px'],
                                        id: 'layerDemo' + type
                                        ,
                                        title:'供需类型',
                                        content: '<div style="align-content: center;"><select name="constellation" id="gxType" style="width: 90% !important;margin-top: 5%;margin-left: 5%;"  lay-verify="required">\n' +
                                            '                                                        <option value="001">供方</option>\n' +
                                            '                                                        <option value="002">需方</option>\n' +
                                            '                                            </select></div>'
                                        ,
                                        btn: '关闭全部'
                                        ,
                                        btnAlign: 'c' //按钮居中
                                        ,
                                        shade: 0 //不显示遮罩
                                        ,
                                        btn: ['确定', '关闭'] //只是为了演示
                                        ,
                                        yes: function () {
                                            var type=$("#gxType").val();
                                            $.ajax({
                                                url:'/user/insertGxtype',
                                                type:'post',
                                                data:{type:type},
                                                success:function(d){
                                                    if(d.flag){
                                                        setTimeout(function(){
                                                            window.open('/supplier/index','_self');
                                                        },1000);
                                                    }
                                                }
                                            })
                                        }
                                        ,
                                        btn2: function () {
                                            layer.closeAll();
                                        }
                                    });
                                });
                            }else{
                                window.open('/supplier/index','_self');
                            }
                        }
                    })
                    return false;
                }

            }
        });
        var bs=localStorage.getItem("todoinfo")
        if(bs){
            grzxclick();
            localStorage.removeItem("todoinfo");
        }

    });
    function changeLogo(imgSrc){
        if(imgSrc){
            $("#mainimg7").attr('src','');
            $("#mainimg7").attr('src',imgSrc);
        }
    }
    function grzxclick(){
        $("#project a:eq(1)").click();
    }


    function renderDateColumn(value, status, startdate, endDate) {
        // 2014-12-01 去掉 -
        value = value.replace(/-/g, '');// 单元格的值为202412 这种到月份的
        // 获取这之间的年月
        var monthbeetwns = getMonthsBetweenKK(startdate, endDate)
        console.log(monthbeetwns, "monthbeetwns");

        startdate = startdate.replace(/-/g, '');//  20241029
        endDate = endDate.replace(/-/g, '');//  20271127
        var color='red';
        if(status=='已完成'){
            color='red';
            if (monthbeetwns.includes(value)) {
                return `  <div style="width: 100%; height: 10px; background-color: red;  overflow: hidden; ">
              </div>`;
            }
        }else if(status=='进行中'){
            color='#39A9FF'
            if (monthbeetwns.includes(value)) {
                return `  <div style="width: 100%; height: 10px; background-color: #39A9FF;  overflow: hidden; ">
            </div>`;
            }
        }

        return '';
    }

    function getMonthsBetweenKK(startStr, endStr) {
        // 将输入的字符串转换为 Date 对象
        let startDate = new Date(startStr);
        let endDate = new Date(endStr);
        //
        let months = [];

        while (startDate <= endDate) {
            let year = startDate.getFullYear();
            const month = String(startDate.getMonth() + 1).padStart(2, '0');
            // 将年月添加到结果数组中
            months.push(year + '' + month);
            // 增加一个月
            startDate.setMonth(startDate.getMonth() + 1)

            // 防止日期溢出，确保始终在月末
            if (startDate.getDate() !== endDate.getDate()) {
                startDate.setDate(1); // 设置为每月的第一天
            }
        }

        return months;
    }


    // 初始化项目进度
    function innitProjectProcessTable() {

        var jsondata = {}
        $.ajax({
            url: '/project/projectManager/projectJdIndex/tableHead',
            data: jsondata,
            type: 'get',
            dataType: 'json',
            success: function (res) {
                console.log(res);
                if (res.flag && res.data) {
                    var  projectId=res.data.projectId
                    var  colList=res.data.colList
                    console.log(colList,"表头");
                    console.log(projectId,"项目Id");
                    //设置表格:
                    //方法级渲染  初始为计划类别统计
                    table.render({
                        id: 'stageList',
                        elem: '#stageList',
                        url: '/project/projectManager/projectJd/showNoJdStageList?projectId=' + projectId + '&type=1&xmType=1',
                        page: false,
                        height: 300,
                        where: jsondata,
                        cols: [colList.map(function (col) {
                            if (col.field.startsWith('dateStr')) {
                                col.templet = function (k) {
                                    return renderDateColumn(col.title, k.status, k.startDateStr, k.endDateStr);
                                };
                            }
                            return col;
                        })],
                        done: function (res, currentCount) {
                            // document.querySelector('#stageList').style.overflowX = 'auto
                            //td 中 属性data-field 的值以dateStr 开头的单元格 中  .layui-table-cel 类名的中的padding设置为0设置为0
                            var tds = document.querySelectorAll('td[data-field^="dateStr"]');
                            for (var i = 0; i < tds.length; i++) {
                                // 获取当前单元格的中 div
                                var div = tds[i].querySelector('div');
                                // 设置padding 为0
                                //设置 display: flex; justify-content: center; align-items: center;
                                div.style.display = 'flex';
                                div.style.justifyContent = 'center';
                                div.style.alignItems = 'center';
                                div.style.padding = '0';
                                tds[i].style.border = 'none';
                            }

                        }
                    });

                }
            }
        })

    }


</script>

<script type="text/html" id="status">

    {{#  if(d.status == '未开始'){ }}
    <span class="status-not-started">{{ d.status }}</span>
    {{#  } else if(d.status == '进行中'){ }}
    <span class="status-in-progress">{{ d.status }}</span>
    {{#  } else{ }}
    <span class="status-completed">{{ d.status }}</span>
    {{#  }  }}
</script>



<style>
    .status-completed {
        color: red;
        background-color: #FFECED;
        padding: 2px 5px;
    }

    .status-in-progress {
        color: #45AEFF;
        padding: 2px 5px;
        background-color: #E1F5FF;
    }

    .status-not-started {
        color: green;
        padding: 2px 5px;
        background-color: #C8FF96;

    }
</style>
</body>

</html>
